<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/white/common/common.jsp"%>
<%@include file="/white/common/taglibs.jsp"%>
<html>
	<head>
		<script type="text/javascript">
        function submitForm(){
            var searchForm=document.getElementById("searchForm");
            searchForm.submit();
        }
        
        function notAllowedLockSelf(id){           
            var searchForm=document.getElementById("searchForm");
            searchForm.action="userAction-"+id+"!lock.action";
            searchForm.submit();            
        }
        
        function validateModify(){        	
        	var check = document.getElementsByName("selectedIds");
        	var a = 0;
            var id;
           
            for(var i=0;i <check.length;i++){
                if(check[i].checked==true){
                    a++;
                    id = check[i].value;
                }
            }
            
            if(a == 1){            	
            	var searchForm=document.getElementById("searchForm");
            	searchForm.action="nspFetchLogAction-"+id+"!toEdit.action";
            	searchForm.submit();
                return true;
            }else{
                alert("请选择一条记录");
                return false;
            }
        }        
        
        function fetchNspLog(){    
                var url = ""
                          	
            	var searchForm=document.getElementById("searchForm");
            	
            	url = "nspFetchLogAction!fetchNspLogData.action";
            	
            	openWindow(url,850,500);
               
           
        }        
        
        
        
        function validateDelete(){
            var check=document.getElementsByName("selectedIds");
            var a=false;
            for(var i=0;i <check.length;i++){
                if(check[i].checked==true){
                    a=true;
                    break;
                }
            }
            if(a){
                return confirm('你确定所选');
            }else{
                alert("请先择你要删除的内容!!");
                return false;
            }
        }

        function doDelete(){
            var searchForm=document.getElementById("searchForm");
            searchForm.action='nspFetchLogAction!delete.action';
            searchForm.submit();
            return true;
        }
        
        function displayResult(){
            var result = "<s:property value='result'/>";
            if(result != null && result != ""){
                alert(result);
            }
        } 
        
        function getLogByServer(){
        	var dateTime=document.getElementById("logerDateId").value;
        	var startTimeId=document.getElementById("startTimeId").value;
        	var endTimeId=document.getElementById("endTimeId").value;
        	if(!dateTime){
        		alert("日期不能为空");
        	}
        	else if(parseInt(endTimeId)<parseInt(startTimeId)){
        		alert("时间段选择，截止时间必须大于等于开始时间");
        	}else{
        		  searchForm.action='nspFetchLogAction!getServerLoger.action';
                  searchForm.submit();
        	}
        	
        	
        }
        
        function fileNameSearch(){
        	
        	 searchForm.action='nspFetchLogAction!queryByPage.action';
             searchForm.submit();
        }
        
    </script>
	</head>
	<body onload="displayResult()">
		<s:form method="post" action="nspFetchLogAction!getServerLoger.action"
			theme="simple" id="searchForm">
			<div id="div_title">
				<h3>
					NSP数据获取日志
				</h3>
				<div id="div_search" >
					<table>
						<tr>
							<!-- 查询条件 -->
							<td width="80" align="right">
								日志名称:
							</td>
							<td>
								<s:textfield name="fileName" />
							</td>						
							<td width="80" align="right">
								Server:
							</td>
							<td>
								<select name="server">
								<option></option>
								<option value="101.227.246.1">101.227.246.1</option>
								</select>
							</td>
							<td width="80" align="right">
								日期:
							</td>
							<td>
								<s:textfield id="logerDateId" name="logerDate" label="日期"
									onfocus="WdatePicker({skin:'whyGreen',dateFmt:'yyyy-MM-dd', minDate:'1900-01-01',maxDate:''})"></s:textfield>
							</td>				
						
							<td width="80" align="right">
								时间段:
							</td>
							<td>
							
								<select name="startTime" id="startTimeId">
								<option value="00">0</option>
								<option value="01">1</option>
								<option value="02">2</option>
								<option value="03">3</option>
								<option value="04">4</option>
								<option value="05">5</option>
								<option value="06">6</option>
								<option value="07">7</option>
								<option value="08">8</option>
								<option value="09">9</option>
								<option value="10">10</option>
								<option value="11">11</option>
								<option value="12">12</option>
								<option value="13">13</option>
								<option value="14">14</option>
								<option value="15">15</option>
								<option value="16">16</option>
								<option value="17">17</option>
								<option value="18">18</option>
								<option value="19">19</option>
								<option value="20">20</option>
								<option value="21">21</option>
								<option value="22">22</option>
								<option value="23">23</option>
								</select>-<select name="endTime" id="endTimeId">
								<option value="00">0</option>
								<option value="01">1</option>
								<option value="02">2</option>
								<option value="03">3</option>
								<option value="04">4</option>
								<option value="05">5</option>
								<option value="06">6</option>
								<option value="07">7</option>
								<option value="08">8</option>
								<option value="09">9</option>
								<option value="10">10</option>
								<option value="11">11</option>
								<option value="12">12</option>
								<option value="13">13</option>
								<option value="14">14</option>
								<option value="15">15</option>
								<option value="16">16</option>
								<option value="17">17</option>
								<option value="18">18</option>
								<option value="19">19</option>
								<option value="20">20</option>
								<option value="21">21</option>
								<option value="22">22</option>
								<option value="23">23</option>
								</select>
							</td>
							<td width="200" align="right">
								<authz:authorize ifAnyGranted="OMC_NSP_FETCH_LOG">
								<input type="button" value="数据获取" class="input_button3" onclick="getLogByServer()">
								&nbsp;&nbsp;&nbsp;&nbsp;
								<input type="button" value="搜索" class="submit_search" onclick="fileNameSearch()">
								<!--<s:submit cssClass="submit_search" value=""
										action="nspFetchLogAction!getServerLoger" />
									<s:submit cssClass="submit_search" value="搜索"
										action="nspFetchLogAction!queryByPage" />-->
								</authz:authorize>
							</td>

						</tr>
					</table>
				</div>
			</div>
			 
			<div id="div_button">
			
			<!--
				<authz:authorize ifAnyGranted="OMC_NSP_FETCH_LOG">
					<s:submit value="新增"
						onclick="form.action='nspFetchLogAction!toAdd.action';return true;"
						cssClass="input_button" />
				</authz:authorize>
				<authz:authorize ifAnyGranted="OMC_NSP_FETCH_LOG">
					<s:submit value="修改" onclick="return validateModify()"
						cssClass="input_button" />
				</authz:authorize>
				<authz:authorize ifAnyGranted="OMC_NSP_FETCH_LOG">
					<input type="button" value="删除"
						onclick="if(validateDelete()){doDelete()}" class="input_button">
				</authz:authorize>
			-->	
			    <authz:authorize ifAnyGranted="OMC_NSP_FETCH_LOG">
					<input type="button" value="NSP日志数据更新"
						onclick="fetchNspLog()"
						cssClass="input_button3" />
				</authz:authorize>
				<%@include file="/white/common/message.jsp"%>
			</div>
			 
			 
			<!--列表 �?�� -->
			<table cellpadding="0" cellspacing="0" class="t_list">
				<tr>
					
					<!--列表头部 -->
					<th>
						FetchLogId
					</th>
					<th>
						服务ID
					</th>
					<th>
						日志文件
					</th>
					<th>
						获取类型
					</th>
					<th>
						获取数据表
					</th>
					<th>
						状态
					</th>
					<th>
						开始时间
					</th>
					<th>
						结束时间
					</th>
					<th>
						起始Id值
					</th>
					<th>
						结束Id值
					</th>					
					<th>
						备注
					</th>
					
				</tr>
				<s:iterator value="resultList" status="sindex">
					<tr>
						
						<td>
							<s:property value="FETCH_LOG_ID" />
						</td>
						<td>
							<s:property value="SERVER_ID" />
						</td>
						<td>
							<s:property value="LOG_FILE_NAME" />
						</td>
						<td>
							<s:property value="FETCH_TYPE" />
						</td>
						<td>
							<s:property value="FETCH_TABLE" />
						</td>
						<td>
							<s:property value="STATUS" />
						</td>
						<td>
							<s:property value="START_TIME" />
						</td>
						<td>
							<s:property value="END_TIME" />
						</td>
						<td>
							<s:property value="START_LOG_ID" />
						</td>
						<td>
							<s:property value="END_LOG_ID" />
						</td>
						<td>
							<s:property value="NOTE" />
						</td>
					</tr>
				</s:iterator>
			</table>
			<!--列表 结束 -->
			<!--分页 �?�� -->
			<s:if test="resultList.size() > 0">
				<table border="0" cellspacing="0" cellpadding="0" class="t_bottom">
					<tr>
						<td><%@include file="/white/common/pageList.jsp"%></td>
					</tr>
				</table>
			</s:if>
			<!--分页 结束 -->

		</s:form>
	</body>
</html>
